package com.example.basic.googleAPI;

import java.io.BufferedReader;
import java.io.FileReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

public class FileUtils {

    public static ArrayList<String> getFeedList() {
        ArrayList<String> list = new ArrayList(1130);

        try {
            FileReader fileReader = new FileReader("feed.txt");
            BufferedReader reader = new BufferedReader(fileReader);

            String line = "";
            while ((line = reader.readLine())!=null) {
                list.add(line);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }


    public static void main(String[] args) {
        System.out.println(getDateStr());
        System.out.println(getTimeStr());
        getTargetURI("");
    }

    private static String getTargetURI(String url) {
        String[] split = url.split("\\?");
        System.out.println("length = " + split.length);
        if (split.length >= 1) {
            System.out.printf("tartgetUrl = " + split[0]);
        }
        return "";
    }

    private static String getDateStr() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date date = new Date(System.currentTimeMillis());
        String dateStr = simpleDateFormat.format(date);
        return dateStr;
    }



    private static String getTimeStr() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
        Date date = new Date(System.currentTimeMillis());
        String timeStr = simpleDateFormat.format(date);
        return timeStr;
    }


}
